#include<stdio.h>
int main()
{
    int i,x,y,last=1;
    printf("Iuput X and Y (X**Y):");
    scanf("%d",&x);
    scanf("%d",&y);
    for(i=1;i<=y;i++)
    last=last*x%1000;
printf("The last 3 digits of %d**%d is:%d\n",x,y,last%1000);
}